//
//  ESCellUserProfile.m
//  Eyeshot
//
//  Created by admin on 15/7/3.
//  Copyright (c) 2015年 eyeshot. All rights reserved.
//

#import "ESCellUserProfile.h"
static UILabel *subLabel;


@implementation ESCellUserProfile

+ (id)buttonWithType:(UIButtonType)buttonType {
    
    ESCellUserProfile *button = [super buttonWithType:buttonType];
    if (button) {
        subLabel = [[UILabel alloc] init];
        [button addSubview:subLabel];
        button.adjustsImageWhenHighlighted = NO;
    }
    return button;
}

- (UILabel *)subLabel {
    if (_subLabel == nil) {
        _subLabel = subLabel;
    }
    return _subLabel;
}

+ (instancetype)cellUserProfile {
    return [ESCellUserProfile buttonWithType:UIButtonTypeCustom];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    
//    for (int i = 0; i < self.subviews.count; i++) {
////        self.imageView.layer.cornerRadius = height/2;
////        self.imageView.layer.masksToBounds = YES;
//        self.imageView.frame = CGRectMake(2 * kHorizen, 2 * kHorizen, height - 2 * kHorizen, height - 2 * kHorizen);
//        self.imageView.hidden = NO;
//        self.titleLabel.frame = CGRectMake(height + kHorizen, 2 * kHorizen, width - height + kHorizen, (height - 2 * kHorizen) * 0.55);
//        self.titleLabel.hidden = NO;
//        self.subLabel.frame = CGRectMake(height + kVertical, ((height - 2 * kHorizen) * 0.55 + 2 * kHorizen), width - height + kHorizen, (height - 2 * kHorizen) * 0.45);
////        self.titleLabel.backgroundColor = [UIColor greenColor];
////        _subLabel.backgroundColor = [UIColor redColor];
//    }
    
    

        self.imageView.frame = CGRectMake(2 * kHorizen, 2 * kHorizen, height - 2 * kHorizen, height - 2 * kHorizen);
        self.imageView.hidden = NO;
        self.titleLabel.frame = CGRectMake(height + kHorizen, 2 * kHorizen, width - height + kHorizen, (height - 2 * kHorizen) * 0.55);
        self.titleLabel.hidden = NO;
        self.subLabel.frame = CGRectMake(height + kVertical, ((height - 2 * kHorizen) * 0.55 + 2 * kHorizen), width - height + kHorizen, (height - 2 * kHorizen) * 0.45);
     
}

@end
